#!/bin/bash

dt=`date -d '-1 day' +"%Y-%m-%d"`

nohup ./dwd_inc.sh > dwd_YYYYMMDD.log 2>&1 &

arr=(dim_aml_account.sql dim_aml_customer.sql dim_aml_rule.sql dim_aml_watchlist.sql fact_aml_alert.sql fact_aml_screening.sql fact_aml_str_report.sql fact_aml_transaction.sql)
for sql in ${arr[@]}; do
hive-f /aml/dwd/"$sql"
hive -hiveconf dt=`date -d '-1 day' +"%Y-%m-%d"`-f "$sql"
hive-partition-key etl_date
hive-partition-value $dt
done